import request from './request.js';
let service = request.service;
let formatterUrl = request.formatterUrl;
export default {
  /**获取码表
   * type - 1 工序名称 type - 2 工序面 type - 4 发票类型 type - 5 付款方式 
   * type - 6 送货方式 type - 7 刀具直径
   *  type - 8 装夹方式 type - 9 数铣指定设备 type - 10 材质 & 密度
   * type-12 供应商类型
   * */ 
  getCodeList(type) {
    return service({
      url: `/adscm/system/code/queryCoedByType/${type}`,
      method: 'get'
    })
  },
  drawInfoUpload() {
    /**type=1:图纸上传 type=2:工艺上传 type=3:图形文件上传 type>10 编程文件上传*/
    return formatterUrl({
      url: '/adscm/operation/plan/drawInfo/upload'
    })
  },
  bigFileUpload(){
    /**大文件上传*/ 
     return formatterUrl({
       url: `/adscm/operation/plan/chunk/upload`
     })
  },
  /***删除上传的大文件 */
  deleteBigFileUpload(id){
    return service({
      url: `/adscm/operation/plan/drawInfo/deleteById/${id}`,
      method: 'get'
    })
  },
  /**大文件上传完成后，回调接口*/
  mergeUpload(data) {
    return service({
       url: `/adscm/operation/plan/chunk/merge`,
       method: 'get',
       params: data
    })
  },
  viewBigFile(id){
    /**大文件pdf预览*/
    return formatterUrl({
      url: `/adscm/operation/plan/chunk/view/${id}`
    })
  },
  /**大文件下载*/
  mergenDownload(data){
    return formatterUrl({
      url: '/adscm/operation/plan/chunk/download',
      params: data
    })
  },
  /**新增 type=1:图纸上传 type=2:工艺上传 type=3:图形文件上传 列表*/
  insertDrawInfoUpload(data) {
    return service({
      url: `/adscm/operation/plan/drawInfo/insert`,
      method: 'post',
      data
    })
  },
  imageUpload() {
    /**图片上传*/
     return formatterUrl({
       url: '/adscm/operation/plan/planTaskTotal/upload'
     })
  },
   /**type=1:图纸下载 type=2:工艺下载 type=3:图形文件下载 */
  drawInfoDownload(data) {
    return formatterUrl({
      url: `/adscm/operation/plan/drawInfo/download`,
      params: data
    })
  },

  /**type=1:图纸上传 type=2:工艺上传 type=3:图形文件上传 列表*/
  drawInfoList(data){
    return service({
      url: `/adscm/operation/plan/drawInfo/select`,
      method: 'get',
      params: data
    })
  },
   /**type>10 编程文件上传 列表*/
   programUploadList(data) {
     return service({
       url: `/adscm/operation/plan/drawInfo/selectProgram`,
       method: 'get',
       params: data
     })
   },
  excelUpload(data) {
    /**excel上传 */
    return service({
      url: `/adscm/operation/plan/planTask/uploadExcel`,
      method: 'post',
      data
    }, 'upload')
  },
  /**删除 */
  deletePdf(data) {
    return service({
      url: `/adscm/operation/plan/planTask/deletePdf`,
      method:'get',
      params:data
    })
  },
  machineAllList() {
    /**获取所有机器列表**/
    return service({
      url: `/adscm/operation/base/machine/selectMachineOnUse`,
       method: 'get',
    })
  },
  /**获取所有采购人员列表*/
  getAllCgPersons(){
    return service({
      url: `/adscm/operation/cg/cgTask/selectCgPersons`,
      method: 'get',
    })
  },
  queryUsersByRoleId(id){
    return service({
      url: `/adscm/system/user/queryUserIsHasRole/${id}`,
      method: 'get',
    })
  },

}